package net;

public class loadlientuc extends Thread{
	private Queues<msg>CMDqueue=new Queues<msg>();
	private Queues<msg>Sendqueue=new Queues<msg>();
	public  loadlientuc(Queues<msg>CMDqueue,Queues<msg>Sendqueue)
	{
		this.CMDqueue=CMDqueue;
		this.Sendqueue=Sendqueue;
		
	}
	public  loadlientuc(){}
	@Override
public void run()
{
	while(true)
	{
		System.out.println("dang chay lao ra consol");
			if(!CMDqueue.isEmpty()) 
			{
			
				msg m =(msg)CMDqueue.dequeue();				
				if(m.getType() == MSGType.DISCONNECTED)
				{
					msg closeCMD = new msg(MSGType.CLIENT_UI_CLOSE, "", "");
					Sendqueue.enqueue(closeCMD);  //Close sending thread
					break;
				}
				//list_MSG.add(m.getData()); //Nhận thông điệp
				//Nhận câu trả lời.
				//Answer an = (Answer) m.getData();
				System.out.println("data is-----------------:"+m.getIP());
			}
			else
			{
				
				try {
					Thread.sleep(200);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
    			continue;
			}
		
	}
	
}
}
